parameters:
  jobTemplate: ''
  variables: {}
  osGroup: ''
  osSubgroup: ''
  archType: ''
  container: ''
  pool: ''
  platform: ''
  shouldContinueOnError: false
  jobParameters: {}

# parameters.jobParameters.helixQueueGroup values:
# 'pr' -- pull request
# 'ci' -- continuous integration ("merge")
# 'libraries' -- libraries tests
# 'cet' -- machines supporting CET technology
# 'superpmi' -- for TeamProject 'internal', a smaller set of queues (one per architecture, not several) for SuperPMI collection
# Many of these values are unused below, as we use the same queues for many of the scenarios.
# However, having these options allows us to easily tune the queues we use for each scenario as needed based on new hardware support.

jobs:
- template: ${{ parameters.jobTemplate }}
  parameters:
    variables: ${{ parameters.variables }}
    osGroup: ${{ parameters.osGroup }}
    osSubgroup: ${{ parameters.osSubgroup }}
    archType: ${{ parameters.archType }}
    container: ${{ parameters.container }}
    pool: ${{ parameters.pool }}
    platform: ${{ parameters.platform }}
    shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
    helixQueues:

    # iOS Simulator/Mac Catalyst arm64
    - ${{ if in(parameters.platform, 'maccatalyst_arm64', 'iossimulator_arm64') }}:
      - OSX.1200.Arm64.Open

    # iOS/tvOS Simulator x64 & MacCatalyst x64
    - ${{ if in(parameters.platform, 'iossimulator_x64', 'tvossimulator_x64', 'maccatalyst_x64') }}:
      - OSX.1200.Amd64.Open

    # Android arm64
    - ${{ if in(parameters.platform, 'android_arm64') }}:
      - Windows.11.Amd64.Android.Open

    # Android x64
    - ${{ if in(parameters.platform, 'android_x64') }}:
      - Ubuntu.2204.Amd64.Android.29.Open

    # Browser wasm
    - ${{ if eq(parameters.platform, 'browser_wasm') }}:
      - (Ubuntu.2204.Amd64)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly

    # iOS devices
    - ${{ if in(parameters.platform, 'ios_arm64') }}:
      - OSX.13.Amd64.Iphone.Open

    # tvOS devices
    - ${{ if in(parameters.platform, 'tvos_arm64') }}:
        - OSX.13.Amd64.AppleTV.Open

    # Linux arm
    - ${{ if eq(parameters.platform, 'linux_arm') }}:
      - ${{ if eq(variables['System.TeamProject'], 'public') }}:
        - (Ubuntu.1804.Arm32.Open)Ubuntu.2004.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7
      - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
        - (Ubuntu.1804.Arm32)Ubuntu.2004.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7

    # Linux arm64
    - ${{ if eq(parameters.platform, 'linux_arm64') }}:
      - ${{ if eq(variables['System.TeamProject'], 'public') }}:
        - (Ubuntu.1804.Arm64.Open)Ubuntu.2004.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8
      - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
        - (Ubuntu.1804.Arm64)Ubuntu.2004.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8

    # Linux musl x64
    - ${{ if eq(parameters.platform, 'linux_musl_x64') }}:
      - ${{ if eq(variables['System.TeamProject'], 'public') }}:
        - (Alpine.317.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-amd64
      - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
        - (Alpine.317.Amd64)Ubuntu.2204.Amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-amd64

    # Linux musl arm32
    - ${{ if eq(parameters.platform, 'linux_musl_arm') }}:
      - ${{ if eq(variables['System.TeamProject'], 'public') }}:
        - (Alpine.316.Arm32.Open)Ubuntu.2004.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm32v7
      - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
        - (Alpine.316.Arm32)Ubuntu.2004.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm32v7

    # Linux musl arm64
    - ${{ if eq(parameters.platform, 'linux_musl_arm64') }}:
      - ${{ if eq(variables['System.TeamProject'], 'public') }}:
        - (Alpine.317.Arm64.Open)Ubuntu.2004.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm64v8
      - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
        - (Alpine.317.Arm64)Ubuntu.2004.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm64v8

    # Linux x64
    - ${{ if eq(parameters.platform, 'linux_x64') }}:
      - ${{ if eq(variables['System.TeamProject'], 'public') }}:
        - Ubuntu.2204.Amd64.Open
      - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
        - Ubuntu.2204.Amd64

    # OSX arm64
    - ${{ if eq(parameters.platform, 'osx_arm64') }}:
      - ${{ if eq(variables['System.TeamProject'], 'public') }}:
        - OSX.1200.ARM64.Open
      - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
        - OSX.1200.ARM64

    # OSX x64
    - ${{ if eq(parameters.platform, 'osx_x64') }}:
      - ${{ if eq(variables['System.TeamProject'], 'public') }}:
        - OSX.1200.Amd64.Open
      - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
        - OSX.1200.Amd64

    # windows x64
    - ${{ if eq(parameters.platform, 'windows_x64') }}:
      - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(parameters.jobParameters.helixQueueGroup, 'cet')) }}:
        - Windows.10.Amd64.Open
      - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(parameters.jobParameters.helixQueueGroup, 'cet')) }}:
        - Windows.11.Amd64.Cet.Open
      - ${{ if and(eq(variables['System.TeamProject'], 'internal'), in(parameters.jobParameters.helixQueueGroup, 'superpmi')) }}:
        - Windows.10.Amd64.X86.Rt
      - ${{ if and(eq(variables['System.TeamProject'], 'internal'), notIn(parameters.jobParameters.helixQueueGroup, 'superpmi')) }}:
        - Windows.10.Amd64

    # windows x86
    - ${{ if eq(parameters.platform, 'windows_x86') }}:
      - ${{ if eq(variables['System.TeamProject'], 'public') }}:
        - Windows.10.Amd64.Open
      - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
        - Windows.10.Amd64.X86.Rt

    # windows arm64
    - ${{ if eq(parameters.platform, 'windows_arm64') }}:
      - ${{ if eq(variables['System.TeamProject'], 'public') }}:
        - Windows.11.Arm64.Open
      - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
        - Windows.11.Arm64

    ${{ insert }}: ${{ parameters.jobParameters }}
